package com.wd.amodel.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;

import com.wd.amodel.util.DemoConfig;

/**
 * NA<BR>
 *
 * @author w4425
 * @version [V0.0.1, 2021/6/2]
 * @since V0.0.1
 */
public class DemoDialogFragment extends DialogFragment {
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        DemoConfig.addPageId(this.getActivity().getPackageName());
        return super.onCreateView(inflater, container, savedInstanceState);
    }
//
//    @Nullable
//    @Override
//    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//        View view = inflater.inflate(R.layout.dialog_demo, null);
//        return view;
//    }

    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog dialog = new AlertDialog.Builder(getActivity())
                .setTitle("神灯")
                .setMessage("来选择你要实现的一个愿望把")
                .setPositiveButton("车子", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                })
                .setNegativeButton("房子", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                }).create();
        return dialog;
    }

    @Override
    public void onPause() {
        super.onPause();
        DemoConfig.removePageId(this.getActivity().getPackageName());
    }
}
